/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ufrgs.inf.delphos.extraction.model.impl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import org.eclipse.jdt.core.IMemberValuePair;
import ufrgs.inf.delphos.extraction.model.DAnnotation;
import ufrgs.inf.delphos.extraction.model.DAnnotationType;
import ufrgs.inf.delphos.extraction.model.DCompilationUnit;
import ufrgs.inf.delphos.extraction.model.DConfig;
import ufrgs.inf.delphos.extraction.model.DPackage;
import ufrgs.inf.delphos.extraction.model.DPolicy;
import ufrgs.inf.delphos.extraction.model.DRelation;
import ufrgs.inf.delphos.extraction.model.DRelationType;
import ufrgs.inf.delphos.extraction.model.DSystem;
import ufrgs.inf.delphos.extraction.model.DelphosSystemModelFactory;
import ufrgs.inf.delphos.extraction.model.DelphosSystemModelPackage;
import ufrgs.inf.delphos.identification.knowledgebase.Tag;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class DelphosSystemModelPackageImpl extends EPackageImpl implements DelphosSystemModelPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dCompilationUnitEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dAnnotationEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dPolicyEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dSystemEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dPackageEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dRelationEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dConfigEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum dRelationTypeEEnum = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum dAnnotationTypeEEnum = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EDataType iMemberValuePairEDataType = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EDataType tagEDataType = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see ufrgs.inf.delphos.extraction.model.DelphosSystemModelPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private DelphosSystemModelPackageImpl() {
		super(eNS_URI, DelphosSystemModelFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link DelphosSystemModelPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static DelphosSystemModelPackage init() {
		if (isInited) return (DelphosSystemModelPackage)EPackage.Registry.INSTANCE.getEPackage(DelphosSystemModelPackage.eNS_URI);

		// Obtain or create and register package
		DelphosSystemModelPackageImpl theDelphosSystemModelPackage = (DelphosSystemModelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DelphosSystemModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DelphosSystemModelPackageImpl());

		isInited = true;

		// Initialize simple dependencies
		EcorePackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theDelphosSystemModelPackage.createPackageContents();

		// Initialize created meta-data
		theDelphosSystemModelPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theDelphosSystemModelPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(DelphosSystemModelPackage.eNS_URI, theDelphosSystemModelPackage);
		return theDelphosSystemModelPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDCompilationUnit() {
		return dCompilationUnitEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDCompilationUnit_Annotations() {
		return (EReference)dCompilationUnitEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDCompilationUnit_Relations() {
		return (EReference)dCompilationUnitEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getDCompilationUnit_Tags() {
		return (EAttribute)dCompilationUnitEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDAnnotation() {
		return dAnnotationEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getDAnnotation_AnnotationType() {
		return (EAttribute)dAnnotationEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getDAnnotation_MappedAtributes() {
		return (EAttribute)dAnnotationEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDPolicy() {
		return dPolicyEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDSystem() {
		return dSystemEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDSystem_Policies() {
		return (EReference)dSystemEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDSystem_Packages() {
		return (EReference)dSystemEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDSystem_ConfigFiles() {
		return (EReference)dSystemEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDPackage() {
		return dPackageEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDPackage_CompUnits() {
		return (EReference)dPackageEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDPackage_Packages() {
		return (EReference)dPackageEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDRelation() {
		return dRelationEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getDRelation_Target() {
		return (EReference)dRelationEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getDRelation_RelationType() {
		return (EAttribute)dRelationEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDConfig() {
		return dConfigEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getDRelationType() {
		return dRelationTypeEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getDAnnotationType() {
		return dAnnotationTypeEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EDataType getIMemberValuePair() {
		return iMemberValuePairEDataType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EDataType getTag() {
		return tagEDataType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DelphosSystemModelFactory getDelphosSystemModelFactory() {
		return (DelphosSystemModelFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		dCompilationUnitEClass = createEClass(DCOMPILATION_UNIT);
		createEReference(dCompilationUnitEClass, DCOMPILATION_UNIT__ANNOTATIONS);
		createEReference(dCompilationUnitEClass, DCOMPILATION_UNIT__RELATIONS);
		createEAttribute(dCompilationUnitEClass, DCOMPILATION_UNIT__TAGS);

		dAnnotationEClass = createEClass(DANNOTATION);
		createEAttribute(dAnnotationEClass, DANNOTATION__ANNOTATION_TYPE);
		createEAttribute(dAnnotationEClass, DANNOTATION__MAPPED_ATRIBUTES);

		dPolicyEClass = createEClass(DPOLICY);

		dSystemEClass = createEClass(DSYSTEM);
		createEReference(dSystemEClass, DSYSTEM__POLICIES);
		createEReference(dSystemEClass, DSYSTEM__PACKAGES);
		createEReference(dSystemEClass, DSYSTEM__CONFIG_FILES);

		dPackageEClass = createEClass(DPACKAGE);
		createEReference(dPackageEClass, DPACKAGE__COMP_UNITS);
		createEReference(dPackageEClass, DPACKAGE__PACKAGES);

		dRelationEClass = createEClass(DRELATION);
		createEReference(dRelationEClass, DRELATION__TARGET);
		createEAttribute(dRelationEClass, DRELATION__RELATION_TYPE);

		dConfigEClass = createEClass(DCONFIG);

		// Create enums
		dRelationTypeEEnum = createEEnum(DRELATION_TYPE);
		dAnnotationTypeEEnum = createEEnum(DANNOTATION_TYPE);

		// Create data types
		iMemberValuePairEDataType = createEDataType(IMEMBER_VALUE_PAIR);
		tagEDataType = createEDataType(TAG);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		dCompilationUnitEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dAnnotationEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dPolicyEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dSystemEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dPackageEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dRelationEClass.getESuperTypes().add(theEcorePackage.getENamedElement());
		dConfigEClass.getESuperTypes().add(theEcorePackage.getENamedElement());

		// Initialize classes and features; add operations and parameters
		initEClass(dCompilationUnitEClass, DCompilationUnit.class, "DCompilationUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getDCompilationUnit_Annotations(), this.getDAnnotation(), null, "annotations", null, 0, -1, DCompilationUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getDCompilationUnit_Relations(), this.getDRelation(), null, "relations", null, 0, -1, DCompilationUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getDCompilationUnit_Tags(), this.getTag(), "tags", null, 0, -1, DCompilationUnit.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(dAnnotationEClass, DAnnotation.class, "DAnnotation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getDAnnotation_AnnotationType(), this.getDAnnotationType(), "annotationType", null, 0, 1, DAnnotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getDAnnotation_MappedAtributes(), theEcorePackage.getEEList(), "mappedAtributes", null, 0, 1, DAnnotation.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(dPolicyEClass, DPolicy.class, "DPolicy", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(dSystemEClass, DSystem.class, "DSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getDSystem_Policies(), this.getDPolicy(), null, "policies", null, 0, -1, DSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getDSystem_Packages(), this.getDPackage(), null, "packages", null, 0, -1, DSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getDSystem_ConfigFiles(), this.getDConfig(), null, "configFiles", null, 0, -1, DSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(dPackageEClass, DPackage.class, "DPackage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getDPackage_CompUnits(), this.getDCompilationUnit(), null, "compUnits", null, 0, -1, DPackage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getDPackage_Packages(), this.getDPackage(), null, "packages", null, 0, -1, DPackage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(dRelationEClass, DRelation.class, "DRelation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getDRelation_Target(), this.getDCompilationUnit(), null, "target", null, 0, 1, DRelation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getDRelation_RelationType(), this.getDRelationType(), "relationType", null, 0, 1, DRelation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(dConfigEClass, DConfig.class, "DConfig", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Initialize enums and add enum literals
		initEEnum(dRelationTypeEEnum, DRelationType.class, "DRelationType");
		addEEnumLiteral(dRelationTypeEEnum, DRelationType.INTERFACE);
		addEEnumLiteral(dRelationTypeEEnum, DRelationType.IMPORT);
		addEEnumLiteral(dRelationTypeEEnum, DRelationType.CALL);
		addEEnumLiteral(dRelationTypeEEnum, DRelationType.EXCEPTION);
		addEEnumLiteral(dRelationTypeEEnum, DRelationType.INHERITANCE);

		initEEnum(dAnnotationTypeEEnum, DAnnotationType.class, "DAnnotationType");
		addEEnumLiteral(dAnnotationTypeEEnum, DAnnotationType.PERMIT_ALL);
		addEEnumLiteral(dAnnotationTypeEEnum, DAnnotationType.ROLES_ALLOWED);
		addEEnumLiteral(dAnnotationTypeEEnum, DAnnotationType.RUN_AS);
		addEEnumLiteral(dAnnotationTypeEEnum, DAnnotationType.DECLARE_ROLES);
		addEEnumLiteral(dAnnotationTypeEEnum, DAnnotationType.DENY_ALL);

		// Initialize data types
		initEDataType(iMemberValuePairEDataType, IMemberValuePair.class, "IMemberValuePair", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
		initEDataType(tagEDataType, Tag.class, "Tag", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);

		// Create resource
		createResource(eNS_URI);
	}

} //DelphosSystemModelPackageImpl
